﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.zoo.ui {
    import Events.*;
    import Display.DialogUI.*;
    import Classes.*;
    import Display.*;

    public class ZooUnlockDialog extends GenericDialog {

        protected var m_spawner:MechanicMapResource;

        public function ZooUnlockDialog(_arg1:MechanicMapResource){
            this.m_spawner = _arg1;
            var _local2:String = ZLoc.t("Items", (this.m_spawner.getItem().unlocksItem + "_friendlyName"));
            var _local3:String = ZLoc.t("Dialogs", "ZooUnlock_ok");
            var _local4:String = Global.gameSettings.getItemByName(this.m_spawner.getItem().unlocksItem).iconRelative;
            super(ZLoc.t("Dialogs", "ZooUnlock_message", {item:_local2}), "ZooUnlock", GenericDialogView.TYPE_CUSTOM_OK, this.onZooUnlockClose, "ZooUnlock", _local4, true, GenericDialogView.ICON_POS_LEFT, "", null, _local3);
            addEventListener(MarketEvent.MARKET_BUY, UI.onMarketClick, false, 0, true);
        }
        protected function onZooUnlockClose(_arg1:GenericPopupEvent):void{
            var _local2:MarketEvent;
            if (_arg1.button == GenericDialogView.YES){
                _local2 = new MarketEvent(MarketEvent.MARKET_BUY, MarketEvent.GENERIC, this.m_spawner.getItem().unlocksItem);
                _local2.eventSource = MarketEvent.SOURCE_INVENTORY;
                dispatchEvent(_local2);
                if (ZooDialogView.currentInstance){
                    ZooDialogView.currentInstance.close();
                };
            };
        }

    }
}//package Modules.zoo.ui 
